package com.zzg.demo.laboratory.circulardependencies;

import jakarta.annotation.Resource;
import org.springframework.context.annotation.Lazy;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;


@RestController
@RequestMapping("/circulardependencies")
public class TestServiveA {
    // 注解注入
    @Resource
    // 懒加载方式破解循环
    @Lazy
    private TestServiceB testServiceB;

    @GetMapping
    public String testA(){
        String testA = "testA";
        System.out.println(testA);
        String s = testServiceB.testB();
        System.out.println(s);
        return testA;
    }
    
}
